Skip to content

Use base-36 change tags in MockCloudDatabase - #580

Open
lukaskubanek wants to merge 2 commits into
pointfreeco:mainfrom
structuredpath:base36-change-tags
Open

lukaskubanek wants to merge 2 commits into
pointfreeco:mainfrom
structuredpath:base36-change-tags

Conversation

@lukaskubanek

Copy link
Copy Markdown
Contributor

Follow-up to the discussion in #573. The mock cloud database now hands out change tags as base-36 strings, which is the format actually used by CloudKit.

  • Change tags are zero-based, so the first saved record gets "0", then "1", "2", …, "9", "a", …, "z", "10", and so on.
  • MockSyncEngine compares tags with a new isNewerChangeTag(than:) helper, since plain string comparison breaks once tags pass "z". A test covers the ordering.

Purely cosmetic for the current behavior, as discussed. The idea is to keep the mock as close to CloudKit as possible for anything that reads _recordChangeTag later.

Comment on lines +27 to +28
// NB: CloudKit uses base-36 change tags (0…9, a…z, 10…zz, 100…).
mutating func nextRecordChangeTag() -> String {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// NB: CloudKit uses base-36 change tags (0…9, a…z, 10…zz, 100…).
mutating func nextRecordChangeTag() -> String {
mutating func nextRecordChangeTag() -> String {

lukaskubanek added a commit to structuredpath/sqlite-data that referenced this pull request Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants